{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div>\n",
    "<a href=\"https://bokeh.org/\"><img src=\"../images/bokeh-header.png\"></a>\n",
    "</div>\n",
    "\n",
    "<table style=\"float:left; border:none\">\n",
    "   <tr style=\"border:none\">\n",
    "       <td style=\"border:none\">\n",
    "           <a href=\"https://bokeh.org/\">     \n",
    "           <img \n",
    "               src=\"../tutorial/assets/bokeh-transparent.png\" \n",
    "               style=\"width:50px\"\n",
    "           >\n",
    "           </a>    \n",
    "       </td>\n",
    "       <td style=\"border:none\">\n",
    "           <h1>Bokeh Quickstart</h1>\n",
    "       </td>\n",
    "   </tr>\n",
    "</table>\n",
    "\n",
    "<div style=\"float:right;\"><h2>Bokeh 5-minute Overview</h2></div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Bokeh is a Python interactive visualization library that targets modern web browsers for presentation. Its goal is to provide elegant, concise construction of novel graphics in the style of D3.js, and to extend this capability with high-performance interactivity over very large or streaming datasets. Bokeh can help anyone who would like to quickly and easily create interactive plots, dashboards, and data applications.\n",
    "\n",
    "## Simple Example\n",
    "Here is a simple first example. First we'll import the figure function from bokeh.plotting, which will let us create all sorts of interesting plots easily. We also import the show and ouptut_notebook functions from bokeh.io — these let us display our results inline in the notebook."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.plotting import figure \n",
    "from bokeh.io import output_notebook, show"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Next, we'll tell Bokeh to display its plots directly into the notebook. This will cause all of the Javascript and data to be embedded directly into the HTML of the notebook itself. (Bokeh can output straight to HTML files, or use a server, which we'll look at later.)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"1002\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  var JS_MIME_TYPE = 'application/javascript';\n",
       "  var HTML_MIME_TYPE = 'text/html';\n",
       "  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  var CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    var cell = handle.cell;\n",
       "\n",
       "    var id = cell.output_area._bokeh_element_id;\n",
       "    var server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            var id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    var output_area = handle.output_area;\n",
       "    var output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      var bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      var script_attrs = bk_div.children[0].attributes;\n",
       "      for (var i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      var toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    var events = require('base/js/events');\n",
       "    var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    var el = document.getElementById(\"1002\");\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error() {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < css_urls.length; i++) {\n",
       "      var url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.0.1.min.js\": \"JpP8FXbgAZLkfur7LiK3j9AGBhHNIvF742meBJrjO2ShJDhCG2I1uVvW+0DUtrmc\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.0.1.min.js\": \"xZlADit0Q04ISQEdKg2k3L4W9AwQBAuDs9nJL9fM/WwzL1tEU9VPNezOFX0nLEAz\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.0.1.min.js\": \"4BuPRZkdMKSnj3zoxiNrQ86XgNw0rYmBOxe7nshquXwwcauupgBF2DHLVG1WuZlV\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.0.1.min.js\": \"Dv1SQ87hmDqK6S5OhBf0bCuwAEvL5QYL0PuR/F1SPVhCS/r/abjkbpKDYL2zeM19\"};\n",
       "\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      if (url in hashes) {\n",
       "        element.crossOrigin = \"anonymous\";\n",
       "        element.integrity = \"sha384-\" + hashes[url];\n",
       "      }\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };var element = document.getElementById(\"1002\");\n",
       "  if (element == null) {\n",
       "    console.error(\"Bokeh: ERROR: autoload.js configured with elementid '1002' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  \n",
       "  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.0.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.0.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.0.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.0.1.min.js\"];\n",
       "  var css_urls = [];\n",
       "  \n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "    \n",
       "    \n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if (root.Bokeh !== undefined || force === true) {\n",
       "      \n",
       "    for (var i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i].call(root, root.Bokeh);\n",
       "    }\n",
       "    if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"1002\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  var NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    var el = document.getElementById(\"1002\");\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.0.1.min.js\": \"JpP8FXbgAZLkfur7LiK3j9AGBhHNIvF742meBJrjO2ShJDhCG2I1uVvW+0DUtrmc\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.0.1.min.js\": \"xZlADit0Q04ISQEdKg2k3L4W9AwQBAuDs9nJL9fM/WwzL1tEU9VPNezOFX0nLEAz\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.0.1.min.js\": \"4BuPRZkdMKSnj3zoxiNrQ86XgNw0rYmBOxe7nshquXwwcauupgBF2DHLVG1WuZlV\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.0.1.min.js\": \"Dv1SQ87hmDqK6S5OhBf0bCuwAEvL5QYL0PuR/F1SPVhCS/r/abjkbpKDYL2zeM19\"};\n\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      if (url in hashes) {\n        element.crossOrigin = \"anonymous\";\n        element.integrity = \"sha384-\" + hashes[url];\n      }\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };var element = document.getElementById(\"1002\");\n  if (element == null) {\n    console.error(\"Bokeh: ERROR: autoload.js configured with elementid '1002' but no matching script tag was found. \")\n    return false;\n  }\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  \n  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.0.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.0.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.0.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.0.1.min.js\"];\n  var css_urls = [];\n  \n\n  var inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    function(Bokeh) {\n    \n    \n    }\n  ];\n\n  function run_inline_js() {\n    \n    if (root.Bokeh !== undefined || force === true) {\n      \n    for (var i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n    if (force === true) {\n        display_loaded();\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      var cell = $(document.getElementById(\"1002\")).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "output_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Next, we'll import NumPy and create some simple data."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from numpy import cos, linspace\n",
    "x = linspace(-6, 6, 100)\n",
    "y = cos(x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we'll call Bokeh's figure function to create a plot p. Then we call the `circle()` method of the plot to render a red circle at each of the points in *x* and *y*.\n",
    "\n",
    "We can immediately interact with the plot:\n",
    "\n",
    "- click-drag will pan the plot around.\n",
    "- mousewheel will zoom in and out (after enabling in the toolbar)\n",
    "\n",
    "The toolbar below is the default one that is available for all plots. It can be configured further via the tools keyword argument."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"4418d6c9-7b09-4e44-beca-9961a565ab47\" data-root-id=\"1003\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"30716e70-de50-425d-a174-bd2c7ca146c5\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1012\"}],\"center\":[{\"id\":\"1015\"},{\"id\":\"1019\"}],\"left\":[{\"id\":\"1016\"}],\"plot_height\":500,\"plot_width\":500,\"renderers\":[{\"id\":\"1037\"}],\"title\":{\"id\":\"1039\"},\"toolbar\":{\"id\":\"1027\"},\"x_range\":{\"id\":\"1004\"},\"x_scale\":{\"id\":\"1008\"},\"y_range\":{\"id\":\"1006\"},\"y_scale\":{\"id\":\"1010\"}},\"id\":\"1003\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1026\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1017\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data\":{\"x\":{\"__ndarray__\":\"AAAAAAAAGMCEDz744IMXwAgffPDBBxfAjC666KKLFsAQPvjggw8WwJNNNtlkkxXAF1100UUXFcCbbLLJJpsUwB988MEHHxTAo4suuuiiE8Anm2yyySYTwKqqqqqqqhLALrrooosuEsCyySabbLIRwDbZZJNNNhHAuuiiiy66EMA++OCDDz4QwIQPPvjggw/AjC666KKLDsCTTTbZZJMNwJtssskmmwzAo4suuuiiC8CqqqqqqqoKwLLJJptssgnAuuiiiy66CMDCBx988MEHwMomm2yyyQbA0UUXXXTRBcDZZJNNNtkEwOGDDz744APA6KKLLrroAsDwwQcffPABwPjggw8++ADAAAAAAAAAAMAQPvjggw/+vyB88MEHH/y/MLrooosu+r88+OCDDz74v0w22WSTTfa/XHTRRRdd9L9ssskmm2zyv3zwwQcffPC/GF100UUX7b842WSTTTbpv1BVVVVVVeW/cNFFF1104b8gm2yyySbbv2CTTTbZZNO/QBdddNFFx78AH3zwwQevvwAffPDBB68/QBdddNFFxz9gk0022WTTPzCbbLLJJts/eNFFF1104T9YVVVVVVXlPzjZZJNNNuk/GF100UUX7T988MEHH3zwP2yyySabbPI/YHTRRRdd9D9QNtlkk032P0D44IMPPvg/MLrooosu+j8gfPDBBx/8PxA++OCDD/4/AAAAAAAAAED44IMPPvgAQPDBBx988AFA6KKLLrro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bzgvwYNBzyQ6eO/wpQK3pDL5r98k1xY71fpv8z5xvIYheu/+pJWneBK7b9g5j+nnaLuv2KAysJEh++/lWFJ+Hr177+zMvFAouvvv2soMprfae+/pK/Cehpy7r+I5mSr9Qftv38pRp7BMOu/yEpIeGjz6L9bmTMXVFjmvzOtZnZOaeO/GSzA6Fwx4L8t1s9jLXnZv08V/jTvL9K/pYFip7xExb/uV1fH02anv3PrzzyaTrM/m2jcYAsEyT/R8oH0ZwHUPyc8XOmiNds/pycYONMB4T+oNfsz8SjkP/LRslpTBOc/WLzTHz6J6T+tE73JOq7rPwlj6v46a+0/9iJ4Cbe57j8=\",\"dtype\":\"float64\",\"shape\":[100]}},\"selected\":{\"id\":\"1046\"},\"selection_policy\":{\"id\":\"1045\"}},\"id\":\"1034\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"formatter\":{\"id\":\"1044\"},\"ticker\":{\"id\":\"1013\"}},\"id\":\"1012\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1004\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1008\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1044\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1006\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1010\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1013\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1012\"},\"ticker\":null},\"id\":\"1015\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"1034\"},\"glyph\":{\"id\":\"1035\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1036\"},\"selection_glyph\":null,\"view\":{\"id\":\"1038\"}},\"id\":\"1037\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"formatter\":{\"id\":\"1042\"},\"ticker\":{\"id\":\"1017\"}},\"id\":\"1016\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis\":{\"id\":\"1016\"},\"dimension\":1,\"ticker\":null},\"id\":\"1019\",\"type\":\"Grid\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"firebrick\"},\"line_alpha\":{\"value\":0.5},\"line_color\":{\"value\":\"firebrick\"},\"size\":{\"units\":\"screen\",\"value\":7},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1035\",\"type\":\"Circle\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"firebrick\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"firebrick\"},\"size\":{\"units\":\"screen\",\"value\":7},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1036\",\"type\":\"Circle\"},{\"attributes\":{\"overlay\":{\"id\":\"1026\"}},\"id\":\"1022\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"text\":\"\"},\"id\":\"1039\",\"type\":\"Title\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1020\"},{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"},{\"id\":\"1025\"}]},\"id\":\"1027\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1046\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1025\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1020\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1023\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1042\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"source\":{\"id\":\"1034\"}},\"id\":\"1038\",\"type\":\"CDSView\"}],\"root_ids\":[\"1003\"]},\"title\":\"Bokeh Application\",\"version\":\"2.0.1\"}};\n",
       "  var render_items = [{\"docid\":\"30716e70-de50-425d-a174-bd2c7ca146c5\",\"root_ids\":[\"1003\"],\"roots\":{\"1003\":\"4418d6c9-7b09-4e44-beca-9961a565ab47\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1003"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "p = figure(width=500, height=500)\n",
    "p.circle(x, y, size=7, color=\"firebrick\", alpha=0.5)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Bar Plot Example\n",
    "Bokeh's core display model relies on *composing graphical primitives* which are bound to data series. This is similar in spirit to D3, and different than most other Python plotting libraries.\n",
    "\n",
    "A slightly more sophisticated example demonstrates this idea.\n",
    "\n",
    "Bokeh ships with a small set of interesting \"sample data\" in the `bokeh.sampledata` package. We'll load up some historical automobile mileage data, which is returned as a Pandas `DataFrame`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.sampledata.autompg import autompg\n",
    "\n",
    "grouped = autompg.groupby(\"yr\")\n",
    "\n",
    "mpg = grouped.mpg\n",
    "avg, std = mpg.mean(), mpg.std()\n",
    "years = list(grouped.groups)\n",
    "american = autompg[autompg[\"origin\"]==1]\n",
    "japanese = autompg[autompg[\"origin\"]==3]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For each year, we want to plot the distribution of MPG within that year."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"707032a8-18fd-4bfe-b44f-87d29b3d8f86\" data-root-id=\"1102\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"160fef6d-e05d-4f7b-be3f-e1b036c2d661\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1113\"}],\"center\":[{\"id\":\"1116\"},{\"id\":\"1120\"},{\"id\":\"1146\"}],\"left\":[{\"id\":\"1117\"}],\"renderers\":[{\"id\":\"1138\"},{\"id\":\"1151\"},{\"id\":\"1165\"}],\"title\":{\"id\":\"1103\"},\"toolbar\":{\"id\":\"1128\"},\"x_range\":{\"id\":\"1105\"},\"x_scale\":{\"id\":\"1109\"},\"y_range\":{\"id\":\"1107\"},\"y_scale\":{\"id\":\"1111\"}},\"id\":\"1102\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1126\",\"type\":\"HelpTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1127\"}},\"id\":\"1123\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1105\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1124\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1125\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1196\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"label\":{\"value\":\"Japanese\"},\"renderers\":[{\"id\":\"1151\"}]},\"id\":\"1161\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1197\",\"type\":\"Selection\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1121\"},{\"id\":\"1122\"},{\"id\":\"1123\"},{\"id\":\"1124\"},{\"id\":\"1125\"},{\"id\":\"1126\"}]},\"id\":\"1128\",\"type\":\"Toolbar\"},{\"attributes\":{\"source\":{\"id\":\"1148\"}},\"id\":\"1152\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"1162\"},\"glyph\":{\"id\":\"1163\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1164\"},\"selection_glyph\":null,\"view\":{\"id\":\"1166\"}},\"id\":\"1165\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":null},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"1137\",\"type\":\"VBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"blue\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1164\",\"type\":\"Triangle\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.3},\"fill_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.3},\"line_color\":{\"value\":\"blue\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1163\",\"type\":\"Triangle\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.5},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1149\",\"type\":\"Circle\"},{\"attributes\":{\"data\":{\"x\":[70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82],\"y\":{\"__ndarray__\":\"AAAAAAAAMkAAAAAAAAAuQAAAAAAAADJAAAAAAAAAMEAAAAAAAAAxQAAAAAAAAC5AAAAAAAAALEAAAAAAAAAsQAAAAAAAACxAAAAAAAAALkAAAAAAAAAuQAAAAAAAACxAAAAAAAAALkAAAAAAAAAsQAAAAAAAADZAAAAAAAAAMkAAAAAAAAA1QAAAAAAAADVAAAAAAAAAJEAAAAAAAAAkQAAAAAAAACZAAAAAAAAAIkAAAAAAAAA8QAAAAAAAADNAAAAAAAAAMEAAAAAAAAAxQAAAAAAAADNAAAAAAAAAM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AAAAAA8QAAAAAAAADtAAAAAAAAAQUAAAAAAAAA/QAAAAAAAAD1AAAAAAAAAO0AAAAAAAAA4QAAAAAAAAENAAAAAAAAAQkAAAAAAAAA5QAAAAAAAAENAAAAAAAAAOkAAAAAAAAA2QAAAAAAAAEJAAAAAAAAAO0AAAAAAAAA7QAAAAAAAAEBAAAAAAAAAPEAAAAAAAAA/QA==\",\"dtype\":\"float64\",\"shape\":[245]}},\"selected\":{\"id\":\"1197\"},\"selection_policy\":{\"id\":\"1196\"}},\"id\":\"1162\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1150\",\"type\":\"Circle\"},{\"attributes\":{\"data_source\":{\"id\":\"1148\"},\"glyph\":{\"id\":\"1149\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1150\"},\"selection_glyph\":null,\"view\":{\"id\":\"1152\"}},\"id\":\"1151\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[70,70,71,71,71,71,72,72,72,72,72,73,73,73,73,74,74,74,74,74,74,75,75,75,75,76,76,76,76,77,77,77,77,77,77,78,78,78,78,78,78,78,78,79,79,80,80,80,80,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82],\"y\":{\"__ndarray__\":\"AAAAAAAAOEAAAAAAAAA7QAAAAAAAADtAAAAAAAAAOUAAAAAAAAA/QAAAAAAAgEFAAAAAAAAAOEAAAAAAAAAzQAAAAAAAADxAAAAAAAAAN0AAAAAAAAA7QAAAAAAAADRAAAAAAAAANkAAAAAAAAAyQAAAAAAAADRAAAAAAAAAP0AAAAAAAABAQAAAAAAAAD9AAAAAAAAAQEAAAAAAAAA4QAAAAAAAADpAAAAAAAAAPUAAAAAAAAA4QAAAAAAAADhAAAAAAACAQEAAAAAAAIBAQAAAAAAAAEBAAAAAAAAAPEAAAAAAAAAzQAAAAAAAgD9AAAAAAADAQEAAAAAAAAA6QAAAAAAAAD5AAAAAAAAANkAAAAAAAIA1QGZmZmZmZkBAMzMzMzOzQ0DNzMzMzAxCQAAAAAAAgDtAMzMzMzMzO0CamZmZmRk1QGZmZmZm5jdAAAAAAACAPUDNzMzMzAxBQM3MzMzMzD9AzczMzMwMQ0CamZmZmZlCQM3MzMzMzD1AzczMzMxMP0AAAAAAAIBCQJqZmZmZGUBAzczMzMxMR0BmZmZmZmZEQM3MzMzMTEZAZmZmZmbmQECamZmZmVlAQDMzMzMzszdAMzMzMzMzQEDNzMzMzIxDQM3MzMzMjEFAZmZmZmYmQEAAAAAAAIBCQJqZmZmZ2UJAzczMzMwMQUCamZmZmdlAQDMzMzMzM0BAMzMzMzNzQECamZmZmZk/QGZmZmZmZjlAMzMzMzMzOEAAAAAAAIBCQAAAAAAAAD9AAAAAAAAAQkAAAAAAAABCQAAAAAAAAEFAAAAAAAAAQ0AAAAAAAABAQAAAAAAAAENAAAAAAAAAQEA=\",\"dtype\":\"float64\",\"shape\":[79]}},\"selected\":{\"id\":\"1175\"},\"selection_policy\":{\"id\":\"1174\"}},\"id\":\"1148\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1144\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1127\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_color\":{\"value\":null},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"1136\",\"type\":\"VBar\"},{\"attributes\":{\"source\":{\"id\":\"1162\"}},\"id\":\"1166\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"1135\"}},\"id\":\"1139\",\"type\":\"CDSView\"},{\"attributes\":{\"text\":\"MPG by Year (Japan and US)\"},\"id\":\"1103\",\"type\":\"Title\"},{\"attributes\":{\"label\":{\"value\":\"American\"},\"renderers\":[{\"id\":\"1165\"}]},\"id\":\"1177\",\"type\":\"LegendItem\"},{\"attributes\":{\"data_source\":{\"id\":\"1135\"},\"glyph\":{\"id\":\"1136\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1137\"},\"selection_glyph\":null,\"view\":{\"id\":\"1139\"}},\"id\":\"1138\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1174\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1109\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1175\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1122\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1142\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1107\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1111\",\"type\":\"LinearScale\"},{\"attributes\":{\"formatter\":{\"id\":\"1144\"},\"ticker\":{\"id\":\"1114\"}},\"id\":\"1113\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1114\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1113\"},\"ticker\":null},\"id\":\"1116\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"1142\"},\"ticker\":{\"id\":\"1118\"}},\"id\":\"1117\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1159\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1118\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1117\"},\"dimension\":1,\"ticker\":null},\"id\":\"1120\",\"type\":\"Grid\"},{\"attributes\":{\"items\":[{\"id\":\"1147\"},{\"id\":\"1161\"},{\"id\":\"1177\"}],\"location\":\"top_left\"},\"id\":\"1146\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1121\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1158\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"label\":{\"value\":\"MPG 1 stddev\"},\"renderers\":[{\"id\":\"1138\"}]},\"id\":\"1147\",\"type\":\"LegendItem\"},{\"attributes\":{\"data\":{\"bottom\":{\"__ndarray__\":\"gvFgx2qzKECcKci59t4sQJZdRzm5jipAzvVtn6zMKECki7kXNjswQIpnc6D2pi5ApAV4qVNeL0DtFQi6+rIwQBxLQL6+KTFAWBwW2YNMMkBnDzEy+Oo6QAq856zmjDhAfzfsSXnEOkA=\",\"dtype\":\"float64\",\"shape\":[13]},\"top\":{\"__ndarray__\":\"55jlF2UHN0DAzlQxaMk7QBEIyj5aJjhATTh849zMNUD6TNCFok49QMPUTjgNNTlA1KLp0Ht2O0AT6vdFBQ0+QNr+XjaL9T5AVt48aCfjP0AojYptQ1hEQPSsO6IX6UFAQOQJW8OdQkA=\",\"dtype\":\"float64\",\"shape\":[13]},\"x\":[70,71,72,73,74,75,76,77,78,79,80,81,82]},\"selected\":{\"id\":\"1159\"},\"selection_policy\":{\"id\":\"1158\"}},\"id\":\"1135\",\"type\":\"ColumnDataSource\"}],\"root_ids\":[\"1102\"]},\"title\":\"Bokeh Application\",\"version\":\"2.0.1\"}};\n",
       "  var render_items = [{\"docid\":\"160fef6d-e05d-4f7b-be3f-e1b036c2d661\",\"root_ids\":[\"1102\"],\"roots\":{\"1102\":\"707032a8-18fd-4bfe-b44f-87d29b3d8f86\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1102"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "p = figure(title=\"MPG by Year (Japan and US)\")\n",
    "\n",
    "p.vbar(x=years, bottom=avg-std, top=avg+std, width=0.8, \n",
    "       fill_alpha=0.2, line_color=None, legend_label=\"MPG 1 stddev\")\n",
    "\n",
    "p.circle(x=japanese[\"yr\"], y=japanese[\"mpg\"], size=10, alpha=0.5,\n",
    "         color=\"red\", legend_label=\"Japanese\")\n",
    "\n",
    "p.triangle(x=american[\"yr\"], y=american[\"mpg\"], size=10, alpha=0.3,\n",
    "           color=\"blue\", legend_label=\"American\")\n",
    "\n",
    "p.legend.location = \"top_left\"\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**This kind of approach can be used to generate other kinds of interesting plots**. See many more examples in the [Bokeh Documentation Gallery](https://docs.bokeh.org/en/latest/docs/gallery.html).\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Linked Brushing\n",
    "To link plots together at a data level, we can explicitly wrap the data in a `ColumnDataSource`. This allows us to reference columns by name.\n",
    "\n",
    "We can use a \"select\" tool to select points on one plot, and the linked points on the other plots will highlight."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"5da8ddb2-e347-4929-b3a2-26504dad53fb\" data-root-id=\"1422\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"f0cc332c-1157-4098-9621-1a0190af1ad6\":{\"roots\":{\"references\":[{\"attributes\":{\"children\":[{\"id\":\"1419\"},{\"id\":\"1421\"}]},\"id\":\"1422\",\"type\":\"Row\"},{\"attributes\":{\"below\":[{\"id\":\"1359\"}],\"center\":[{\"id\":\"1362\"},{\"id\":\"1366\"}],\"left\":[{\"id\":\"1363\"}],\"plot_height\":300,\"plot_width\":300,\"renderers\":[{\"id\":\"1384\"}],\"title\":{\"id\":\"1349\"},\"toolbar\":{\"id\":\"1375\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1351\"},\"x_scale\":{\"id\":\"1355\"},\"y_range\":{\"id\":\"1353\"},\"y_scale\":{\"id\":\"1357\"}},\"id\":\"1348\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1410\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1296\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"xs_units\":\"screen\",\"ys_units\":\"screen\"},\"id\":\"1298\",\"type\":\"PolyAnnotation\"},{\"attributes\":{},\"id\":\"1329\",\"type\":\"PanTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1291\"},{\"id\":\"1292\"},{\"id\":\"1293\"},{\"id\":\"1294\"},{\"id\":\"1295\"}]},\"id\":\"1299\",\"type\":\"Toolbar\"},{\"attributes\":{\"text\":\"HP vs. Displacement\"},\"id\":\"1311\",\"type\":\"Title\"},{\"attributes\":{\"source\":{\"id\":\"1271\"}},\"id\":\"1309\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"1271\"},\"glyph\":{\"id\":\"1306\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1307\"},\"selection_glyph\":null,\"view\":{\"id\":\"1309\"}},\"id\":\"1308\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_color\":{\"value\":\"green\"},\"line_color\":{\"value\":\"green\"},\"x\":{\"field\":\"hp\"},\"y\":{\"field\":\"displ\"}},\"id\":\"1344\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1367\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1322\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1313\",\"type\":\"DataRange1d\"},{\"attributes\":{\"formatter\":{\"id\":\"1401\"},\"ticker\":{\"id\":\"1322\"}},\"id\":\"1321\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1319\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1315\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1317\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis\":{\"id\":\"1321\"},\"ticker\":null},\"id\":\"1324\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"1399\"},\"ticker\":{\"id\":\"1326\"}},\"id\":\"1325\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1326\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1325\"},\"dimension\":1,\"ticker\":null},\"id\":\"1328\",\"type\":\"Grid\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1335\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1373\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"data_source\":{\"id\":\"1271\"},\"glyph\":{\"id\":\"1344\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1345\"},\"selection_glyph\":null,\"view\":{\"id\":\"1347\"}},\"id\":\"1346\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1330\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"green\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"green\"},\"x\":{\"field\":\"hp\"},\"y\":{\"field\":\"displ\"}},\"id\":\"1345\",\"type\":\"Circle\"},{\"attributes\":{\"overlay\":{\"id\":\"1335\"}},\"id\":\"1331\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1334\"}},\"id\":\"1332\",\"type\":\"BoxSelectTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1336\"}},\"id\":\"1333\",\"type\":\"LassoSelectTool\"},{\"attributes\":{\"toolbars\":[{\"id\":\"1299\"},{\"id\":\"1337\"},{\"id\":\"1375\"}],\"tools\":[{\"id\":\"1291\"},{\"id\":\"1292\"},{\"id\":\"1293\"},{\"id\":\"1294\"},{\"id\":\"1295\"},{\"id\":\"1329\"},{\"id\":\"1330\"},{\"id\":\"1331\"},{\"id\":\"1332\"},{\"id\":\"1333\"},{\"id\":\"1367\"},{\"id\":\"1368\"},{\"id\":\"1369\"},{\"id\":\"1370\"},{\"id\":\"1371\"}]},\"id\":\"1420\",\"type\":\"ProxyToolbar\"},{\"attributes\":{\"overlay\":{\"id\":\"1374\"}},\"id\":\"1371\",\"type\":\"LassoSelectTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1373\"}},\"id\":\"1369\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1368\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1372\"}},\"id\":\"1370\",\"type\":\"BoxSelectTool\"},{\"attributes\":{\"formatter\":{\"id\":\"1410\"},\"ticker\":{\"id\":\"1364\"}},\"id\":\"1363\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1364\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1363\"},\"dimension\":1,\"ticker\":null},\"id\":\"1366\",\"type\":\"Grid\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1334\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"children\":[[{\"id\":\"1272\"},0,0],[{\"id\":\"1310\"},0,1],[{\"id\":\"1348\"},0,2]]},\"id\":\"1419\",\"type\":\"GridBox\"},{\"attributes\":{\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"xs_units\":\"screen\",\"ys_units\":\"screen\"},\"id\":\"1336\",\"type\":\"PolyAnnotation\"},{\"attributes\":{\"below\":[{\"id\":\"1283\"}],\"center\":[{\"id\":\"1286\"},{\"id\":\"1290\"}],\"left\":[{\"id\":\"1287\"}],\"plot_height\":300,\"plot_width\":300,\"renderers\":[{\"id\":\"1308\"}],\"title\":{\"id\":\"1273\"},\"toolbar\":{\"id\":\"1299\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1275\"},\"x_scale\":{\"id\":\"1279\"},\"y_range\":{\"id\":\"1277\"},\"y_scale\":{\"id\":\"1281\"}},\"id\":\"1272\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1390\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1329\"},{\"id\":\"1330\"},{\"id\":\"1331\"},{\"id\":\"1332\"},{\"id\":\"1333\"}]},\"id\":\"1337\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1279\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1277\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1391\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1392\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1355\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_color\":{\"value\":null},\"line_color\":{\"value\":\"red\"},\"size\":{\"field\":\"cyl\",\"units\":\"screen\"},\"x\":{\"field\":\"mpg\"},\"y\":{\"field\":\"displ\"}},\"id\":\"1382\",\"type\":\"Circle\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1372\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"axis\":{\"id\":\"1283\"},\"ticker\":null},\"id\":\"1286\",\"type\":\"Grid\"},{\"attributes\":{\"text\":\"MPG vs. Displacement\"},\"id\":\"1349\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1288\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":null},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"red\"},\"size\":{\"field\":\"cyl\",\"units\":\"screen\"},\"x\":{\"field\":\"mpg\"},\"y\":{\"field\":\"displ\"}},\"id\":\"1383\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1353\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1412\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1297\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"text\":\"MPG by Year\"},\"id\":\"1273\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1284\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1351\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1291\",\"type\":\"PanTool\"},{\"attributes\":{\"data\":{\"accel\":{\"__ndarray__\":\"AAAAAAAAKEAAAAAAAAAnQAAAAAAAACZAAAAAAAAAKEAAAAAAAAAlQAAAAAAAACRAAAAAAAAAIkAAAAAAAAAhQAAAAAAAACRAAAAAAAAAIUAAAAAAAAAkQAAA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AAAAAAIBRQAAAAAAAgF5AAAAAAADAWkAAAAAAAOBgQAAAAAAA4GJAAAAAAACAY0AAAAAAAKBlQAAAAAAA4GBAAAAAAADAU0AAAAAAAIBVQAAAAAAAQFRAAAAAAABAWEAAAAAAAEBVQAAAAAAAQFZAAAAAAADAVkAAAAAAAEBaQAAAAAAAgFhAAAAAAACAWEAAAAAAAEBaQAAAAAAAwFpAAAAAAAAAW0AAAAAAAMBdQAAAAAAAAF5AAAAAAACgYUAAAAAAACBiQAAAAAAAAGVAAAAAAABAYkAAAAAAAOBsQAAAAAAA4HVAAAAAAAAAaUAAAAAAACBsQAAAAAAAAFxAAAAAAAAAXEAAAAAAAABcQAAAAAAAAFxAAAAAAADgYEAAAAAAAOBiQAAAAAAAgGFAAAAAAABAWkAAAAAAAMBWQAAAAAAAwFZAAAAAAABAWkAAAAAAAIBYQAAAAAAAAF5AAAAAAADAWkAAAAAAAABbQAAAAAAAwFZAAAAAAADAVkAAAAAAAMBWQAAAAAAAoGZAAAAAAABgcEAAAAAAAIBjQAAAAAAAAG1AAAAAAAAAYkAAAAAAAOBgQAAAAAAA4GJAAAAAAACAYUAAAAAAAEBYQAAAAAAA4GBAAAAAAAAAXkAAAAAAAMBdQA==\",\"dtype\":\"float64\",\"shape\":[392]},\"hp\":[130,165,150,150,140,198,220,215,225,190,170,160,150,225,95,95,97,85,88,46,87,90,95,113,90,215,200,210,193,88,90,95,100,105,100,88,100,165,175,153,150,180,170,175,110,72,100,88,86,90,70,76,65,69,60,70,95,80,54,90,86,165,175,150,153,150,208,155,160,190,97,150,130,140,150,112,76,87,69,86,92,97,80,88,175,150,145,137,150,198,150,158,150,215,225,175,105,100,100,88,95,46,150,167,170,180,100,88,72,94,90,85,107,90,145,230,49,75,91,112,150,110,122,180,95,100,100,67,80,65,75,100,110,105,140,150,150,140,150,83,67,78,52,61,75,75,75,97,93,67,95,105,72,72,170,145,150,148,110,105,110,95,110,110,129,75,83,100,78,96,71,97,97,70,90,95,88,98,115,53,86,81,92,79,83,140,150,120,152,100,105,81,90,52,60,70,53,100,78,110,95,71,70,75,72,102,150,88,108,120,180,145,130,150,68,80,58,96,70,145,110,145,130,110,105,100,98,180,170,190,149,78,88,75,89,63,83,67,78,97,110,110,48,66,52,70,60,110,140,139,105,95,85,88,100,90,105,85,110,120,145,165,139,140,68,95,97,75,95,105,85,97,103,125,115,133,71,68,115,85,88,90,110,130,129,138,135,155,142,125,150,71,65,80,80,77,125,71,90,70,70,65,69,90,115,115,90,76,60,70,65,90,88,90,90,78,90,75,92,75,65,105,65,48,48,67,67,67,67,62,132,100,88,72,84,84,92,110,84,58,64,60,67,65,62,68,63,65,65,74,75,75,100,74,80,76,116,120,110,105,88,85,88,88,88,85,84,90,92,74,68,68,63,70,88,75,70,67,67,67,110,85,92,112,96,84,90,86,52,84,79,82],\"index\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391],\"mpg\":{\"__ndarray__\":\"AAAAAAAAMkAAAAAAAAAuQAAAAAAAADJAAAAAAAAAMEAAAAAAAAAxQAAAAAAAAC5AAAAAAAAALEAAAAAAAAAsQAAAAAAAACxAAAAAAAAALkAAAAAAAAAuQAAAAAAAACxAAAAAAAAALkAAAAAAAAAsQAAAAAAAADhAAAAAAAAANkAAAAAAAAAyQAAAAAAAADVAAAAAAAAAO0AAAAAAAAA6QAAAAAAAADlAAAAAAAAAOEAAAAAAAAA5QAAAAAAAADpAAAAAAAAANUAAAAAAAAAkQAAAAAAAACRAAAAAAAAAJkAAAAAAAAAiQAAAAAAAADtAAAAAAAAAPEAAAAAAAAA5QAAAAAAAADNAAAAAAAAAMEAAAAAAAAAxQAAAAAAAADNAAAAAAAAAMkAAAAAAAAAsQAAAAAAAACxAAAAAAAAALEAAAAAAAAAsQAAAAAAAAChAAAAAAAAAKkAAAAAAAAAqQAAAAAAAADJAAAAAAAAANkAAAAAAAAAzQAAAAAAAADJAAAAAAAAAN0AAAAAAAAA8QAAAAAAAAD5AAAAAAAAAPkAAAAAAAAA/QAAAAAAAgEFAAAAAAAAAO0AAAAAAAAA6QAAAAAAAADhAAAAAAAAAOUAAAAAAAAA3QAAAAAAAADRAAAAAAAAANUAAAAAAAAAqQAAAAAAAACxAAAAAAAAALkAAAAAAAAAsQAAAAAAAADFAAAAAAAAAJkAAAAAAAAAqQAAAAAAAAChAAAAAAAAAKkAAAAAAAAAzQAAAAAAAAC5AAAAAAAAAKkAAAAAAAAAqQAAAAAAAACxAAAAAAAAAMkAAAAAAAAA2QAAAAAAAADVAAAAAAAAAOkAA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AAAAQkAAAAAAAABBQAAAAAAAAENAAAAAAAAAQEAAAAAAAABDQAAAAAAAADlAAAAAAAAAQ0AAAAAAAAA6QAAAAAAAADZAAAAAAAAAQEAAAAAAAABCQAAAAAAAADtAAAAAAAAAO0AAAAAAAABGQAAAAAAAAEBAAAAAAAAAPEAAAAAAAAA/QA==\",\"dtype\":\"float64\",\"shape\":[392]},\"name\":[\"chevrolet chevelle malibu\",\"buick skylark 320\",\"plymouth satellite\",\"amc rebel sst\",\"ford torino\",\"ford galaxie 500\",\"chevrolet impala\",\"plymouth fury iii\",\"pontiac catalina\",\"amc ambassador dpl\",\"dodge challenger se\",\"plymouth 'cuda 340\",\"chevrolet monte carlo\",\"buick estate wagon (sw)\",\"toyota corona mark ii\",\"plymouth duster\",\"amc hornet\",\"ford maverick\",\"datsun pl510\",\"volkswagen 1131 deluxe sedan\",\"peugeot 504\",\"audi 100 ls\",\"saab 99e\",\"bmw 2002\",\"amc gremlin\",\"ford f250\",\"chevy c20\",\"dodge d200\",\"hi 1200d\",\"datsun pl510\",\"chevrolet vega 2300\",\"toyota corona\",\"amc gremlin\",\"plymouth satellite custom\",\"chevrolet chevelle malibu\",\"ford torino 500\",\"amc matador\",\"chevrolet impala\",\"pontiac catalina brougham\",\"ford galaxie 500\",\"plymouth fury iii\",\"dodge monaco (sw)\",\"ford country squire (sw)\",\"pontiac safari (sw)\",\"amc hornet sportabout (sw)\",\"chevrolet vega (sw)\",\"pontiac firebird\",\"ford mustang\",\"mercury capri 2000\",\"opel 1900\",\"peugeot 304\",\"fiat 124b\",\"toyota corolla 1200\",\"datsun 1200\",\"volkswagen model 111\",\"plymouth cricket\",\"toyota corona hardtop\",\"dodge colt hardtop\",\"volkswagen type 3\",\"chevrolet vega\",\"ford pinto runabout\",\"chevrolet impala\",\"pontiac catalina\",\"plymouth fury iii\",\"ford galaxie 500\",\"amc ambassador sst\",\"mercury marquis\",\"buick lesabre custom\",\"oldsmobile delta 88 royale\",\"chrysler newport royal\",\"mazda rx2 coupe\",\"amc matador (sw)\",\"chevrolet chevelle concours (sw)\",\"ford gran torino (sw)\",\"plymouth satellite custom (sw)\",\"volvo 145e (sw)\",\"volkswagen 411 (sw)\",\"peugeot 504 (sw)\",\"renault 12 (sw)\",\"ford pinto (sw)\",\"datsun 510 (sw)\",\"toyouta corona mark ii (sw)\",\"dodge colt (sw)\",\"toyota corolla 1600 (sw)\",\"buick century 350\",\"amc matador\",\"chevrolet malibu\",\"ford gran torino\",\"dodge coronet custom\",\"mercury marquis brougham\",\"chevrolet caprice classic\",\"ford ltd\",\"plymouth fury gran sedan\",\"chrysler new yorker brougham\",\"buick electra 225 custom\",\"amc ambassador brougham\",\"plymouth valiant\",\"chevrolet nova custom\",\"amc hornet\",\"ford maverick\",\"plymouth duster\",\"volkswagen super beetle\",\"chevrolet impala\",\"ford country\",\"plymouth custom suburb\",\"oldsmobile vista cruiser\",\"amc gremlin\",\"toyota carina\",\"chevrolet vega\",\"datsun 610\",\"maxda rx3\",\"ford pinto\",\"mercury capri v6\",\"fiat 124 sport coupe\",\"chevrolet monte carlo s\",\"pontiac grand prix\",\"fiat 128\",\"opel manta\",\"audi 100ls\",\"volvo 144ea\",\"dodge dart custom\",\"saab 99le\",\"toyota mark ii\",\"oldsmobile omega\",\"plymouth duster\",\"amc hornet\",\"chevrolet nova\",\"datsun b210\",\"ford pinto\",\"toyota corolla 1200\",\"chevrolet vega\",\"chevrolet chevelle malibu classic\",\"amc matador\",\"plymouth satellite sebring\",\"ford gran torino\",\"buick century luxus (sw)\",\"dodge coronet custom (sw)\",\"ford gran torino (sw)\",\"amc matador (sw)\",\"audi fox\",\"volkswagen dasher\",\"opel manta\",\"toyota corona\",\"datsun 710\",\"dodge colt\",\"fiat 128\",\"fiat 124 tc\",\"honda civic\",\"subaru\",\"fiat x1.9\",\"plymouth valiant custom\",\"chevrolet nova\",\"mercury monarch\",\"ford maverick\",\"pontiac catalina\",\"chevrolet bel air\",\"plymouth grand fury\",\"ford ltd\",\"buick century\",\"chevroelt chevelle malibu\",\"amc matador\",\"plymouth fury\",\"buick skyhawk\",\"chevrolet monza 2+2\",\"ford mustang ii\",\"toyota corolla\",\"ford pinto\",\"amc gremlin\",\"pontiac astro\",\"toyota corona\",\"volkswagen dasher\",\"datsun 710\",\"ford pinto\",\"volkswagen rabbit\",\"amc pacer\",\"audi 100ls\",\"peugeot 504\",\"volvo 244dl\",\"saab 99le\",\"honda civic cvcc\",\"fiat 131\",\"opel 1900\",\"capri ii\",\"dodge colt\",\"renault 12tl\",\"chevrolet chevelle malibu classic\",\"dodge coronet brougham\",\"amc matador\",\"ford gran torino\",\"plymouth valiant\",\"chevrolet nova\",\"ford maverick\",\"amc hornet\",\"chevrolet chevette\",\"chevrolet woody\",\"vw rabbit\",\"honda civic\",\"dodge aspen se\",\"ford granada ghia\",\"pontiac ventura sj\",\"amc pacer d/l\",\"volkswagen rabbit\",\"datsun b-210\",\"toyota corolla\",\"ford pinto\",\"volvo 245\",\"plymouth volare premier v8\",\"peugeot 504\",\"toyota mark ii\",\"mercedes-benz 280s\",\"cadillac seville\",\"chevy c10\",\"ford f108\",\"dodge d100\",\"honda accord cvcc\",\"buick opel isuzu deluxe\",\"renault 5 gtl\",\"plymouth arrow gs\",\"datsun f-10 hatchback\",\"chevrolet caprice classic\",\"oldsmobile cutlass supreme\",\"dodge monaco brougham\",\"mercury cougar brougham\",\"chevrolet concours\",\"buick skylark\",\"plymouth volare custom\",\"ford granada\",\"pontiac grand prix lj\",\"chevrolet monte carlo landau\",\"chrysler cordoba\",\"ford thunderbird\",\"volkswagen rabbit custom\",\"pontiac sunbird coupe\",\"toyota corolla liftback\",\"ford mustang ii 2+2\",\"chevrolet chevette\",\"dodge colt m/m\",\"subaru dl\",\"volkswagen dasher\",\"datsun 810\",\"bmw 320i\",\"mazda rx-4\",\"volkswagen rabbit custom diesel\",\"ford fiesta\",\"mazda glc deluxe\",\"datsun b210 gx\",\"honda civic cvcc\",\"oldsmobile cutlass salon brougham\",\"dodge diplomat\",\"mercury monarch ghia\",\"pontiac phoenix lj\",\"chevrolet malibu\",\"ford fairmont (auto)\",\"ford fairmont (man)\",\"plymouth volare\",\"amc concord\",\"buick century special\",\"mercury zephyr\",\"dodge aspen\",\"amc concord d/l\",\"chevrolet monte carlo landau\",\"buick regal sport coupe (turbo)\",\"ford futura\",\"dodge magnum xe\",\"chevrolet chevette\",\"toyota corona\",\"datsun 510\",\"dodge omni\",\"toyota celica gt liftback\",\"plymouth sapporo\",\"oldsmobile starfire sx\",\"datsun 200-sx\",\"audi 5000\",\"volvo 264gl\",\"saab 99gle\",\"peugeot 604sl\",\"volkswagen scirocco\",\"honda accord lx\",\"pontiac lemans v6\",\"mercury zephyr 6\",\"ford fairmont 4\",\"amc concord dl 6\",\"dodge aspen 6\",\"chevrolet caprice classic\",\"ford ltd landau\",\"mercury grand marquis\",\"dodge st. regis\",\"buick estate wagon (sw)\",\"ford country squire (sw)\",\"chevrolet malibu classic (sw)\",\"chrysler lebaron town @ country (sw)\",\"vw rabbit custom\",\"maxda glc deluxe\",\"dodge colt hatchback custom\",\"amc spirit dl\",\"mercedes benz 300d\",\"cadillac eldorado\",\"peugeot 504\",\"oldsmobile cutlass salon brougham\",\"plymouth horizon\",\"plymouth horizon tc3\",\"datsun 210\",\"fiat strada custom\",\"buick skylark limited\",\"chevrolet citation\",\"oldsmobile omega brougham\",\"pontiac phoenix\",\"vw rabbit\",\"toyota corolla tercel\",\"chevrolet chevette\",\"datsun 310\",\"chevrolet citation\",\"ford fairmont\",\"amc concord\",\"dodge aspen\",\"audi 4000\",\"toyota corona liftback\",\"mazda 626\",\"datsun 510 hatchback\",\"toyota corolla\",\"mazda glc\",\"dodge colt\",\"datsun 210\",\"vw rabbit c (diesel)\",\"vw dasher (diesel)\",\"audi 5000s (diesel)\",\"mercedes-benz 240d\",\"honda civic 1500 gl\",\"subaru dl\",\"vokswagen rabbit\",\"datsun 280-zx\",\"mazda rx-7 gs\",\"triumph tr7 coupe\",\"honda accord\",\"plymouth reliant\",\"buick skylark\",\"dodge aries wagon (sw)\",\"chevrolet citation\",\"plymouth reliant\",\"toyota starlet\",\"plymouth champ\",\"honda civic 1300\",\"subaru\",\"datsun 210 mpg\",\"toyota tercel\",\"mazda glc 4\",\"plymouth horizon 4\",\"ford escort 4w\",\"ford escort 2h\",\"volkswagen jetta\",\"honda prelude\",\"toyota corolla\",\"datsun 200sx\",\"mazda 626\",\"peugeot 505s turbo diesel\",\"volvo diesel\",\"toyota cressida\",\"datsun 810 maxima\",\"buick century\",\"oldsmobile cutlass ls\",\"ford granada gl\",\"chrysler lebaron salon\",\"chevrolet cavalier\",\"chevrolet cavalier wagon\",\"chevrolet cavalier 2-door\",\"pontiac j2000 se hatchback\",\"dodge aries se\",\"pontiac phoenix\",\"ford fairmont futura\",\"volkswagen rabbit l\",\"mazda glc custom l\",\"mazda glc custom\",\"plymouth horizon miser\",\"mercury lynx l\",\"nissan stanza xe\",\"honda accord\",\"toyota corolla\",\"honda civic\",\"honda civic (auto)\",\"datsun 310 gx\",\"buick century limited\",\"oldsmobile cutlass ciera (diesel)\",\"chrysler lebaron medallion\",\"ford granada l\",\"toyota celica gt\",\"dodge charger 2.2\",\"chevrolet camaro\",\"ford mustang gl\",\"vw pickup\",\"dodge rampage\",\"ford ranger\",\"chevy s-10\"],\"origin\":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1,3,2,2,2,2,2,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,3,3,2,1,3,1,2,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1,1,2,2,2,2,1,3,3,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,3,1,3,3,1,1,2,1,1,2,2,2,2,1,2,3,1,1,1,1,3,1,3,1,1,1,1,1,1,1,1,1,2,2,2,3,3,1,2,2,3,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1,3,2,3,1,2,1,2,2,2,2,3,2,2,1,1,2,1,1,1,1,1,1,1,1,1,1,2,3,1,1,1,1,2,3,3,1,2,1,2,3,2,1,1,1,1,3,1,2,1,3,1,1,1,1,1,1,1,1,1,1,1,1,2,1,3,1,1,1,3,2,3,2,3,2,1,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,1,3,1,1,3,2,2,2,2,2,3,1,1,1,1,1,1,1,1,1,1,1,1,1,2,3,1,1,2,1,2,1,1,1,3,2,1,1,1,1,2,3,1,3,1,1,1,1,2,3,3,3,3,3,1,3,2,2,2,2,3,3,2,3,3,2,3,1,1,1,1,1,3,1,3,3,3,3,3,1,1,1,2,3,3,3,3,2,2,3,3,1,1,1,1,1,1,1,1,1,1,1,2,3,3,1,1,3,3,3,3,3,3,1,1,1,1,3,1,1,1,2,1,1,1],\"weight\":[3504,3693,3436,3433,3449,4341,4354,4312,4425,3850,3563,3609,3761,3086,2372,2833,2774,2587,2130,1835,2672,2430,2375,2234,2648,4615,4376,4382,4732,2130,2264,2228,2634,3439,3329,3302,3288,4209,4464,4154,4096,4955,4746,5140,2962,2408,3282,3139,2220,2123,2074,2065,1773,1613,1834,1955,2278,2126,2254,2408,2226,4274,4385,4135,4129,3672,4633,4502,4456,4422,2330,3892,4098,4294,4077,2933,2511,2979,2189,2395,2288,2506,2164,2100,4100,3672,3988,4042,3777,4952,4464,4363,4237,4735,4951,3821,3121,3278,2945,3021,2904,1950,4997,4906,4654,4499,2789,2279,2401,2379,2124,2310,2472,2265,4082,4278,1867,2158,2582,2868,3399,2660,2807,3664,3102,2901,3336,1950,2451,1836,2542,3781,3632,3613,4141,4699,4457,4638,4257,2219,1963,2300,1649,2003,2125,2108,2246,2489,2391,2000,3264,3459,3432,3158,4668,4440,4498,4657,3907,3897,3730,3785,3039,3221,3169,2171,2639,2914,2592,2702,2223,2545,2984,1937,3211,2694,2957,2945,2671,1795,2464,2220,2572,2255,2202,4215,4190,3962,4215,3233,3353,3012,3085,2035,2164,1937,1795,3651,3574,3645,3193,1825,1990,2155,2565,3150,3940,3270,2930,3820,4380,4055,3870,3755,2045,2155,1825,2300,1945,3880,4060,4140,4295,3520,3425,3630,3525,4220,4165,4325,4335,1940,2740,2265,2755,2051,2075,1985,2190,2815,2600,2720,1985,1800,1985,2070,1800,3365,3735,3570,3535,3155,2965,2720,3430,3210,3380,3070,3620,3410,3425,3445,3205,4080,2155,2560,2300,2230,2515,2745,2855,2405,2830,3140,2795,3410,1990,2135,3245,2990,2890,3265,3360,3840,3725,3955,3830,4360,4054,3605,3940,1925,1975,1915,2670,3530,3900,3190,3420,2200,2150,2020,2130,2670,2595,2700,2556,2144,1968,2120,2019,2678,2870,3003,3381,2188,2711,2542,2434,2265,2110,2800,2110,2085,2335,2950,3250,1850,2145,1845,2910,2420,2500,2290,2490,2635,2620,2725,2385,1755,1875,1760,2065,1975,2050,1985,2215,2045,2380,2190,2210,2350,2615,2635,3230,3160,2900,2930,3415,3725,3060,3465,2605,2640,2395,2575,2525,2735,2865,1980,2025,1970,2125,2125,2160,2205,2245,1965,1965,1995,2945,3015,2585,2835,2665,2370,2950,2790,2130,2295,2625,2720],\"yr\":[70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82]},\"selected\":{\"id\":\"1392\"},\"selection_policy\":{\"id\":\"1391\"}},\"id\":\"1271\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1275\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"xs_units\":\"screen\",\"ys_units\":\"screen\"},\"id\":\"1374\",\"type\":\"PolyAnnotation\"},{\"attributes\":{\"fill_color\":{\"value\":\"blue\"},\"line_color\":{\"value\":\"blue\"},\"x\":{\"field\":\"yr\"},\"y\":{\"field\":\"mpg\"}},\"id\":\"1306\",\"type\":\"Circle\"},{\"attributes\":{\"formatter\":{\"id\":\"1388\"},\"ticker\":{\"id\":\"1288\"}},\"id\":\"1287\",\"type\":\"LinearAxis\"},{\"attributes\":{\"formatter\":{\"id\":\"1390\"},\"ticker\":{\"id\":\"1284\"}},\"id\":\"1283\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1292\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"below\":[{\"id\":\"1321\"}],\"center\":[{\"id\":\"1324\"},{\"id\":\"1328\"}],\"left\":[{\"id\":\"1325\"}],\"plot_height\":300,\"plot_width\":300,\"renderers\":[{\"id\":\"1346\"}],\"title\":{\"id\":\"1311\"},\"toolbar\":{\"id\":\"1337\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1313\"},\"x_scale\":{\"id\":\"1317\"},\"y_range\":{\"id\":\"1315\"},\"y_scale\":{\"id\":\"1319\"}},\"id\":\"1310\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"axis\":{\"id\":\"1359\"},\"ticker\":null},\"id\":\"1362\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"1271\"}},\"id\":\"1347\",\"type\":\"CDSView\"},{\"attributes\":{\"axis\":{\"id\":\"1287\"},\"dimension\":1,\"ticker\":null},\"id\":\"1290\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1281\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1399\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"blue\"},\"x\":{\"field\":\"yr\"},\"y\":{\"field\":\"mpg\"}},\"id\":\"1307\",\"type\":\"Circle\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1367\"},{\"id\":\"1368\"},{\"id\":\"1369\"},{\"id\":\"1370\"},{\"id\":\"1371\"}]},\"id\":\"1375\",\"type\":\"Toolbar\"},{\"attributes\":{\"formatter\":{\"id\":\"1412\"},\"ticker\":{\"id\":\"1360\"}},\"id\":\"1359\",\"type\":\"LinearAxis\"},{\"attributes\":{\"overlay\":{\"id\":\"1298\"}},\"id\":\"1295\",\"type\":\"LassoSelectTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1297\"}},\"id\":\"1293\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"source\":{\"id\":\"1271\"}},\"id\":\"1385\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"1271\"},\"glyph\":{\"id\":\"1382\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1383\"},\"selection_glyph\":null,\"view\":{\"id\":\"1385\"}},\"id\":\"1384\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"overlay\":{\"id\":\"1296\"}},\"id\":\"1294\",\"type\":\"BoxSelectTool\"},{\"attributes\":{},\"id\":\"1357\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1360\",\"type\":\"BasicTicker\"},{\"attributes\":{\"toolbar\":{\"id\":\"1420\"}},\"id\":\"1421\",\"type\":\"ToolbarBox\"},{\"attributes\":{},\"id\":\"1388\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1401\",\"type\":\"BasicTickFormatter\"}],\"root_ids\":[\"1422\"]},\"title\":\"Bokeh Application\",\"version\":\"2.0.1\"}};\n",
       "  var render_items = [{\"docid\":\"f0cc332c-1157-4098-9621-1a0190af1ad6\",\"root_ids\":[\"1422\"],\"roots\":{\"1422\":\"5da8ddb2-e347-4929-b3a2-26504dad53fb\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1422"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.models import ColumnDataSource\n",
    "from bokeh.layouts import gridplot\n",
    "\n",
    "source = ColumnDataSource(autompg)\n",
    "\n",
    "options = dict(plot_width=300, plot_height=300,\n",
    "               tools=\"pan,wheel_zoom,box_zoom,box_select,lasso_select\")\n",
    "\n",
    "p1 = figure(title=\"MPG by Year\", **options)\n",
    "p1.circle(\"yr\", \"mpg\", color=\"blue\", source=source)\n",
    "\n",
    "p2 = figure(title=\"HP vs. Displacement\", **options)\n",
    "p2.circle(\"hp\", \"displ\", color=\"green\", source=source)\n",
    "\n",
    "p3 = figure(title=\"MPG vs. Displacement\", **options)\n",
    "p3.circle(\"mpg\", \"displ\", size=\"cyl\", line_color=\"red\", fill_color=None, source=source)\n",
    "\n",
    "p = gridplot([[ p1, p2, p3]], toolbar_location=\"right\")\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can read more about the `ColumnDataSource` and other Bokeh data structures in [Providing Data for Plots and Tables](https://docs.bokeh.org/en/latest/docs/user_guide/data.html)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Standalone HTML\n",
    "In addition to working well with the Notebook, Bokeh can also save plots out into their own HTML files. Here is the bar plot example from above, but saving into its own standalone file.\n",
    "\n",
    "Now when we call `show()`, a new browser tab is also opened with the plot. If we just wanted to save the file, we would use `save()` instead."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"2e95d9d6-c0c2-4d9c-ad4a-41e690100621\" data-root-id=\"1630\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"72e29e9f-a6df-4303-af9d-199cdeb75731\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1641\"}],\"center\":[{\"id\":\"1644\"},{\"id\":\"1648\"},{\"id\":\"1674\"}],\"left\":[{\"id\":\"1645\"}],\"renderers\":[{\"id\":\"1666\"},{\"id\":\"1679\"},{\"id\":\"1693\"}],\"title\":{\"id\":\"1631\"},\"toolbar\":{\"id\":\"1656\"},\"x_range\":{\"id\":\"1633\"},\"x_scale\":{\"id\":\"1637\"},\"y_range\":{\"id\":\"1635\"},\"y_scale\":{\"id\":\"1639\"}},\"id\":\"1630\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1649\",\"type\":\"PanTool\"},{\"attributes\":{\"axis\":{\"id\":\"1641\"},\"ticker\":null},\"id\":\"1644\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"1670\"},\"ticker\":{\"id\":\"1646\"}},\"id\":\"1645\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1646\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1645\"},\"dimension\":1,\"ticker\":null},\"id\":\"1648\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1762\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1672\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1763\",\"type\":\"Selection\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1649\"},{\"id\":\"1650\"},{\"id\":\"1651\"},{\"id\":\"1652\"},{\"id\":\"1653\"},{\"id\":\"1654\"}]},\"id\":\"1656\",\"type\":\"Toolbar\"},{\"attributes\":{\"data\":{\"bottom\":{\"__ndarray__\":\"gvFgx2qzKECcKci59t4sQJZdRzm5jipAzvVtn6zMKECki7kXNjswQIpnc6D2pi5ApAV4qVNeL0DtFQi6+rIwQBxLQL6+KTFAWBwW2YNMMkBnDzEy+Oo6QAq856zmjDhAfzfsSXnEOkA=\",\"dtype\":\"float64\",\"shape\":[13]},\"top\":{\"__ndarray__\":\"55jlF2UHN0DAzlQxaMk7QBEIyj5aJjhATTh849zMNUD6TNCFok49QMPUTjgNNTlA1KLp0Ht2O0AT6vdFBQ0+QNr+XjaL9T5AVt48aCfjP0AojYptQ1hEQPSsO6IX6UFAQOQJW8OdQkA=\",\"dtype\":\"float64\",\"shape\":[13]},\"x\":[70,71,72,73,74,75,76,77,78,79,80,81,82]},\"selected\":{\"id\":\"1687\"},\"selection_policy\":{\"id\":\"1686\"}},\"id\":\"1663\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1650\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1654\",\"type\":\"HelpTool\"},{\"attributes\":{\"source\":{\"id\":\"1663\"}},\"id\":\"1667\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"1655\"}},\"id\":\"1651\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1652\",\"type\":\"SaveTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1690\"},\"glyph\":{\"id\":\"1691\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1692\"},\"selection_glyph\":null,\"view\":{\"id\":\"1694\"}},\"id\":\"1693\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.3},\"fill_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.3},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1677\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1653\",\"type\":\"ResetTool\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":null},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"1665\",\"type\":\"VBar\"},{\"attributes\":{\"data_source\":{\"id\":\"1663\"},\"glyph\":{\"id\":\"1664\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1665\"},\"selection_glyph\":null,\"view\":{\"id\":\"1667\"}},\"id\":\"1666\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"items\":[{\"id\":\"1675\"},{\"id\":\"1689\"},{\"id\":\"1705\"}],\"location\":\"top_left\"},\"id\":\"1674\",\"type\":\"Legend\"},{\"attributes\":{\"data\":{\"x\":[70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82],\"y\":{\"__ndarray__\":\"AAAAAAAAMkAAAAAAAAAuQAAAAAAAADJAAAAAAAAAMEAAAAAAAAAxQAAAAAAAAC5AAAAAAAAALEAAAAAAAAAsQAAAAAAAACxAAAAAAAAALkAAAAAAAAAuQAAAAAAAACxAAAAAAAAALkAAAAAAA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ZmZmZm5jtAMzMzMzMzO0CamZmZmZk6QM3MzMzMzDlAAAAAAACAN0AAAAAAAAA+QAAAAAAAgENAmpmZmZlZQUAzMzMzMzNBQGZmZmZm5j1AZmZmZmZmNkCamZmZmZk6QDMzMzMzMzRAmpmZmZmZMUAAAAAAAAA8QAAAAAAAADtAAAAAAAAAQUAAAAAAAAA/QAAAAAAAAD1AAAAAAAAAO0AAAAAAAAA4QAAAAAAAAENAAAAAAAAAQkAAAAAAAAA5QAAAAAAAAENAAAAAAAAAOkAAAAAAAAA2QAAAAAAAAEJAAAAAAAAAO0AAAAAAAAA7QAAAAAAAAEBAAAAAAAAAPEAAAAAAAAA/QA==\",\"dtype\":\"float64\",\"shape\":[245]}},\"selected\":{\"id\":\"1763\"},\"selection_policy\":{\"id\":\"1762\"}},\"id\":\"1690\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"label\":{\"value\":\"American\"},\"renderers\":[{\"id\":\"1693\"}]},\"id\":\"1705\",\"type\":\"LegendItem\"},{\"attributes\":{\"source\":{\"id\":\"1690\"}},\"id\":\"1694\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1678\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1702\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"label\":{\"value\":\"MPG 1 stddev\"},\"renderers\":[{\"id\":\"1666\"}]},\"id\":\"1675\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1703\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1670\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"1676\"},\"glyph\":{\"id\":\"1677\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1678\"},\"selection_glyph\":null,\"view\":{\"id\":\"1680\"}},\"id\":\"1679\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.3},\"fill_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.3},\"line_color\":{\"value\":\"blue\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1691\",\"type\":\"Triangle\"},{\"attributes\":{\"text\":\"MPG by Year (Japan and US)\"},\"id\":\"1631\",\"type\":\"Title\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_color\":{\"value\":null},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"1664\",\"type\":\"VBar\"},{\"attributes\":{\"source\":{\"id\":\"1676\"}},\"id\":\"1680\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1642\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data\":{\"x\":[70,70,71,71,71,71,72,72,72,72,72,73,73,73,73,74,74,74,74,74,74,75,75,75,75,76,76,76,76,77,77,77,77,77,77,78,78,78,78,78,78,78,78,79,79,80,80,80,80,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82],\"y\":{\"__ndarray__\":\"AAAAAAAAOEAAAAAAAAA7QAAAAAAAADtAAAAAAAAAOUAAAAAAAAA/QAAAAAAAgEFAAAAAAAAAOEAAAAAAAAAzQAAAAAAAADxAAAAAAAAAN0AAAAAAAAA7QAAAAAAAADRAAAAAAAAANkAAAAAAAAAyQAAAAAAAADRAAAAAAAAAP0AAAAAAAABAQAAAAAAAAD9AAAAAAAAAQEAAAAAAAAA4QAAAAAAAADpAAAAAAAAAPUAAAAAAAAA4QAAAAAAAADhAAAAAAACAQEAAAAAAAIBAQAAAAAAAAEBAAAAAAAAAPEAAAAAAAAAzQAAAAAAAgD9AAAAAAADAQEAAAAAAAAA6QAAAAAAAAD5AAAAAAAAANkAAAAAAAIA1QGZmZmZmZkBAMzMzMzOzQ0DNzMzMzAxCQAAAAAAAgDtAMzMzMzMzO0CamZmZmRk1QGZmZmZm5jdAAAAAAACAPUDNzMzMzAxBQM3MzMzMzD9AzczMzMwMQ0CamZmZmZlCQM3MzMzMzD1AzczMzMxMP0AAAAAAAIBCQJqZmZmZGUBAzczMzMxMR0BmZmZmZmZEQM3MzMzMTEZAZmZmZmbmQECamZmZmVlAQDMzMzMzszdAMzMzMzMzQEDNzMzMzIxDQM3MzMzMjEFAZmZmZmYmQEAAAAAAAIBCQJqZmZmZ2UJAzczMzMwMQUCamZmZmdlAQDMzMzMzM0BAMzMzMzNzQECamZmZmZk/QGZmZmZmZjlAMzMzMzMzOEAAAAAAAIBCQAAAAAAAAD9AAAAAAAAAQkAAAAAAAABCQAAAAAAAAEFAAAAAAAAAQ0AAAAAAAABAQAAAAAAAAENAAAAAAAAAQEA=\",\"dtype\":\"float64\",\"shape\":[79]}},\"selected\":{\"id\":\"1703\"},\"selection_policy\":{\"id\":\"1702\"}},\"id\":\"1676\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"blue\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1692\",\"type\":\"Triangle\"},{\"attributes\":{},\"id\":\"1639\",\"type\":\"LinearScale\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1655\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"label\":{\"value\":\"Japanese\"},\"renderers\":[{\"id\":\"1679\"}]},\"id\":\"1689\",\"type\":\"LegendItem\"},{\"attributes\":{\"formatter\":{\"id\":\"1672\"},\"ticker\":{\"id\":\"1642\"}},\"id\":\"1641\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1635\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1637\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1686\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1687\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1633\",\"type\":\"DataRange1d\"}],\"root_ids\":[\"1630\"]},\"title\":\"Bokeh Application\",\"version\":\"2.0.1\"}};\n",
       "  var render_items = [{\"docid\":\"72e29e9f-a6df-4303-af9d-199cdeb75731\",\"root_ids\":[\"1630\"],\"roots\":{\"1630\":\"2e95d9d6-c0c2-4d9c-ad4a-41e690100621\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1630"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import output_file\n",
    "\n",
    "output_file(\"barplot.html\")\n",
    "\n",
    "p = figure(title=\"MPG by Year (Japan and US)\")\n",
    "\n",
    "p.vbar(x=years, bottom=avg-std, top=avg+std, width=0.8, \n",
    "       fill_alpha=0.2, line_color=None, legend_label=\"MPG 1 stddev\")\n",
    "\n",
    "p.circle(x=japanese[\"yr\"], y=japanese[\"mpg\"], size=10, alpha=0.3,\n",
    "         color=\"red\", legend_label=\"Japanese\")\n",
    "\n",
    "p.triangle(x=american[\"yr\"], y=american[\"mpg\"], size=10, alpha=0.3,\n",
    "           color=\"blue\", legend_label=\"American\")\n",
    "\n",
    "p.legend.location = \"top_left\"\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Bokeh Applications\n",
    "Bokeh also has a server component that can be used to build interactive web applications that easily connect the powerful constellation of PyData tools to sophisticated Bokeh visualizations. The Bokeh server can be used to:\n",
    "\n",
    "- respond to UI and tool events generated in a browser with computations or queries using the full power of python\n",
    "- automatically push server-side updates to the UI (i.e. widgets or plots in a browser)\n",
    "- use periodic, timeout, and asynchronous callbacks to drive streaming updates\n",
    "\n",
    "The cell below shows a simple deployed Bokeh application from https://demo.bokeh.org embedded in an IFrame. Scrub the sliders or change the title to see the plot update."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "        <iframe\n",
       "            width=\"900\"\n",
       "            height=\"410\"\n",
       "            src=\"https://demo.bokeh.org/sliders\"\n",
       "            frameborder=\"0\"\n",
       "            allowfullscreen\n",
       "        ></iframe>\n",
       "        "
      ],
      "text/plain": [
       "<IPython.lib.display.IFrame at 0x7fce086bed30>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.display import IFrame\n",
    "IFrame('https://demo.bokeh.org/sliders', width=900, height=410)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<p>Click on any of the thumbnails below to launch other live Bokeh applications.</p>\n",
    "<center>\n",
    "<a href=\"https://demo.bokeh.org/crossfilter\">\n",
    "  <img \n",
    "    width=\"30%\" height=\"30%\" style=\"display: inline ; padding: 10px;\" \n",
    "    src=\"https://bokeh.pydata.org/static/crossfilter_t.png\"\n",
    "  >\n",
    "</a>\n",
    "\n",
    "<a href=\"https://demo.bokeh.org/movies\">\n",
    "  <img \n",
    "    width=\"30%\" height=\"30%\" style=\"display: inline ; padding: 10px;\" \n",
    "    src=\"https://bokeh.pydata.org/static/movies_t.png\" \n",
    "  >\n",
    "</a>\n",
    "\n",
    "<a href=\"https://demo.bokeh.org/gapminder\">\n",
    "  <img \n",
    "    width=\"30%\" height=\"30%\" style=\"display: inline ; padding: 10px;\" \n",
    "    src=\"https://bokeh.pydata.org/static/gapminder_t.png\"\n",
    "  >\n",
    "</a>\n",
    "</center><p>Find more details and information about developing and deploying Bokeh server applications in the User's Guide chapter <a href=\"https://docs.bokeh.org/en/latest/docs/user_guide/server.html\">Running a Bokeh Server</a>.</p>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2 id=\"BokehJS\">BokehJS<a class=\"anchor-link\" href=\"#BokehJS\">&#182;</a></h2><p>At its core, Bokeh consists of a Javascript library, <a href=\"https://github.com/bokeh/bokeh/tree/master/bokehjs\">BokehJS</a>, and a Python binding which provides classes and objects that ultimately generate a JSON representation of the plot structure.</p>\n",
    "<p>You can read more about design and usage in the <a href=\"https://docs.bokeh.org/en/latest/docs/user_guide/bokehjs.html\">Developing with JavaScript</a> section of the Bokeh User's Guide.</p>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2 id=\"More-Information\">More Information<a class=\"anchor-link\" href=\"#More-Information\">&#182;</a></h2><p>Find more details and information at <a href=\"https://bokeh.org\">https://bokeh.org</a>.</p>\n",
    "<p><img src=\"http://static.bokeh.org/logos/logotype.svg\" width=\"256px\" height=\"64px\"></p>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
